package com.kldy8.kldyw;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.kldy8.kldyw.R;

/**
 * Created by user on 2016/10/19.
 */

public class BaseAppCompatActivity extends AppCompatActivity
{
    //内容是否准备完毕
    private boolean isContentDone;
    //加载
    private RelativeLayout loadingLayout;
    //主界面
    private ViewGroup  mainLayout;
    //加载
    private RelativeLayout reloadlayout;

    private void initLoadingView()
    {
        loadingLayout = (RelativeLayout) findViewById(R.id.loadinglayout);
        loadingLayout.setVisibility(View.VISIBLE);
    }

    private void initReloadlayout()
    {
        reloadlayout = (RelativeLayout) findViewById(R.id.reloadlayout);
        reloadlayout.setVisibility(View.VISIBLE);
    }


    @Override
    protected void onResume()
    {
        super.onResume();
    }

    public void startActivityRightToLeft(Intent intent)
    {
        super.startActivity(intent);
        overridePendingTransition(R.anim.slide_in_right,R.anim.slide_out_left);
    }

    @Override
    public void finish() {
        super.finish();
        overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
    }


    @Override
    public boolean onOptionsItemSelected(MenuItem item)
    {
        switch (item.getItemId()) {
            case android.R.id.home:// 点击返回图标事件
                this.finish();
            default:
                return super.onOptionsItemSelected(item);
        }
    }
}
